package com.mallotec.android.timenote.ui.adapter;

import android.annotation.SuppressLint;
import android.graphics.Paint;
import android.util.SparseBooleanArray;
import android.view.View;

import com.github.lguipeng.library.animcheckbox.AnimCheckBox;
import com.mallotec.android.timenote.data.bean.Timenote;
import com.mallotec.android.timenote.databinding.ItemTimeRecordBinding;
import com.mallotec.android.timenote.ui.adapter.base.BaseDataBindingAdapter;
import com.mallotec.android.timenote.util.DateTimeUtil;
import com.mallotec.android.timenote.viewmodel.TimenoteListViewModel;

import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * @author reborn
 * @program TimeNote
 * @description
 * @create 2020-11-02 04:52
 **/
public class TimenoteAdapter extends BaseDataBindingAdapter<
        Timenote,
        ItemTimeRecordBinding,
        TimenoteListViewModel,
        TimenoteDataBindingHolder> {

    public TimenoteAdapter(int itemLayoutId, TimenoteListViewModel viewModel) {
        super(itemLayoutId, viewModel);
    }

    @Override
    protected void bind(ItemTimeRecordBinding binding, Timenote timenote) {
        binding.setTimenote(timenote);
        binding.itemRecordContent.setText(timenote.getTimenoteContent());
        String startDateTime = "开始于：" + DateTimeUtil.calendarToString(timenote.getStartDatetime());
        String endDateTime = "完成于：" +DateTimeUtil.calendarToString(timenote.getEndDatetime());
        binding.itemRecordStartTime.setText(startDateTime);
        binding.itemRecordEndTime.setText(endDateTime);

    }
}
